package com.gxa.web_admin.controller;

import com.gxa.common.vo.JsonResult;
import com.gxa.common.vo.R;
import com.gxa.modules.pojo.Waybill;
import com.gxa.modules.service.WaybillService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

/**
 * @Auth WK
 * @DATE 2022/9/14 2:24
 * @DESCRIBE
 */
@RestController
@RequestMapping("/waybill")
public class WaybillController {
    @Autowired
    private WaybillService waybillService;

    /**
     * 1.运单列表查询
     * @param currentPage
     * @param pageSize
     * @return
     */
    @GetMapping("/findWaybillList")
    public JsonResult findWaybillList(Integer currentPage , Integer pageSize){
        return waybillService.findWaybillList(currentPage,pageSize);
    }

    /**
     * 2.新增运单
     * @param waybill
     * @return
     */
    @PostMapping("/addWaybill")
    public R addWaybill(Waybill waybill){
        return waybillService.addWaybill(waybill);
    }

    /**
     * 3.运单配载
     * @param waybillId
     * @return
     */
    @PostMapping("/stowageWaybill")
    public R stowageWaybill(Integer waybillId){
        return waybillService.stowageWaybill(waybillId);
    }

    /**
     * 4.运单确认到达
     * @param waybillId
     * @return
     */
    @PostMapping("/updateWaybill")
    public R updateWaybill(Integer waybillId){
        return waybillService.updateWaybill(waybillId);
    }

    /**
     * 5.查看运单详情
     * @param waybillId
     * @return
     */
    @GetMapping("/findWaybill")
    public JsonResult findWaybill(Integer waybillId){
        return waybillService.findWaybill(waybillId);
    }

    /**
     * 6.删除运单
     * @param waybillId
     * @return
     */
    @PostMapping("/delectWaybill")
    public R delectWaybill(Integer waybillId){
        return waybillService.delectWaybill(waybillId);
    }


    /**
     * 7.条件搜索运单
     * @param waybillNumber
     * @param customerName
     * @param payTime
     * @param currentPage
     * @param pageSize
     * @return
     */
    @GetMapping("/findWaybillByCondition")
    public JsonResult findWaybillByCondition(String waybillNumber, String customerName, String payTime, Integer currentPage , Integer pageSize){
        return waybillService.findWaybillByCondition(waybillNumber,customerName,payTime,currentPage,pageSize);
    }

    /**
     * 8.运单查询（待配载)
     * @param currentPage
     * @param pageSize
     * @return
     */
    @GetMapping("/findWaybillByStowage1")
    public JsonResult findWaybillByStowage1(Integer currentPage , Integer pageSize){
        return waybillService.findWaybillByStowage1(currentPage,pageSize);
    }

    /**
     * 9.运单查询（已配载）
     * @param currentPage
     * @param pageSize
     * @return
     */
    @GetMapping("/findWaybillByStowage2")
    public JsonResult findWaybillByStowage2(Integer currentPage , Integer pageSize){
        return waybillService.findWaybillByStowage2(currentPage,pageSize);
    }

    /**
     * 10.运单查询（已完成）
     * @param currentPage
     * @param pageSize
     * @return
     */
    @GetMapping("/findWaybillByStowage3")
    public JsonResult findWaybillByStowage3(Integer currentPage , Integer pageSize){
        return waybillService.findWaybillByStowage3(currentPage,pageSize);
    }

    /**
     * 11.批量删除运单
     * @param waybillIds
     * @return
     */
    @PostMapping("/delectWaybillList")
    public R delectWaybillList(Integer[] waybillIds){
        return waybillService.delectWaybillList(waybillIds);
    }
}
